<%-- 
    Document   : orderMaintenance
    Created on : Jul 5, 2012, 4:06:48 PM
    Author     : Owner
--%>

<%@page import="com.webaccess.retailws.Bean.PaymentBean"%>
<%@include file="/jsp/adminTop.jsp" %>

<html>
    <head>        
        <title>Manage Orders</title>
    </head>
    <body>
        <div class="clear"></div>
        <table cellspacing="5px" width="100%" align="center">
            <tr>
                <td>
                    <table cellspacing="5px" width="100%" align="center">
                        <tr>
                            <td style="vertical-align: top;" width="20%">
                                <%@include file="/jsp/right.jsp" %></td>
                            <td style="vertical-align: top;" width="80%">
                                <div class="page-title"><h1>Manage Orders</h1></div>
                                <table align="center" border="1" cellspacing="10px" width="100%">
                                    <tr>
                                        <td>
                                            <table border="1" cellspacing="10px" id="results" align="center" width="100%">
                                                <colgroup>
                                                    <col width="5%">
                                                    <col width="10%">
                                                    <col width="15%">
                                                    <col width="30%">
                                                    <col width="25%">
                                                    <col width="10%">
                                                    <col width="5%">
                                                </colgroup>
                                                <tr>
                                                    <td><strong>Order</strong></td>
                                                    <td><strong>Date</strong></td>
                                                    <td><strong>Total</strong></td>
                                                    <td><strong>Name</strong></td>
                                                    <td><strong>Pay Type</strong></td>
                                                    <td><strong>Status</strong></td>
                                                    <td><strong>Delete</strong></td>
                                                </tr>
                                                <logic:notPresent name="ordersList" scope="request">
                                                    <tr>
                                                        <td colspan="6"> No records Found </td>
                                                    </tr>
                                                </logic:notPresent>
                                                <logic:present name = "ordersList" scope="request">
                                                    <% PaymentBean[] order = (PaymentBean[]) request.getAttribute("ordersList");
                                                                int i = 0;%>
                                                    <logic:iterate id="orders" name="ordersList" scope="request">
                                                        <tr>
                                                            <td><a href="./payment.do?action=getOrderDetail&orderId=<bean:write name="orders" property="orderId"/>"><bean:write name="orders" property="orderId"/></a></td>
                                                            <td><bean:write name="orders" property="orderDate"/></td>
                                                            <td>Rs. <bean:write name="orders" property="orderInvoiceAmt"/></td>
                                                            <td><bean:write name="orders" property="userName"/></td>
                                                            <td><bean:write name="orders" property="paymentType"/></td>                                                            
                                                            <html:form action="/payment" method="post">
                                                                <%Long orderId = order[i].getOrderId();
                                                                            String jsChangeOS = "javascript:changeOrderStatus('./payment.do?action=updateOrderStatus',this,'paymentBean','" + orderId + "');";
                                                                %>
                                                                <td><html:select name="orders" property="orderStatusId" onchange="<%=jsChangeOS%>">
                                                                        <html:option value="0">-Order Status-</html:option>
                                                                        <html:options collection="orderStatusMap" property="key" labelProperty="value"/>
                                                                    </html:select>
                                                                </td>
                                                            </html:form>                                                            
                                                            <td><a href="./payment.do?action=deleteOrder&orderId=<bean:write name="orders" property="orderId"/>" >Delete</a></td>
                                                        </tr>
                                                        <%i++;%>
                                                    </logic:iterate>
                                                </logic:present>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                <div id="pageNavPosition" align="center"></div>

                                <script type="text/javascript"><!--
                                    var pager = new Pager('results', 10);
                                    pager.init();
                                    pager.showPageNav('pager', 'pageNavPosition');
                                    pager.showPage(1);
                                    //--></script>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td><%@include file="/jsp/footer.jsp" %></td>
            </tr>
        </table>
    </body>
</html>
